<%@page import="java.text.SimpleDateFormat"%>
<%@page import="java.util.List"%>
<%@page import="cn.school.entity.Grade"%>
<%@page import="cn.school.entity.Student"%>
<%@page import="cn.school.service.*"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<%
request.setCharacterEncoding("utf-8");
int stuno=Integer.parseInt(request.getParameter("stuno"));

Service s=new Service();
Student stu=s.getOne(stuno);

SimpleDateFormat sim =new SimpleDateFormat("yyyy-MM-dd");
String enterdate = sim.format(stu.getEnterdate());
String birthday  = sim.format(stu.getBirthday());
%>
<form action="UpdateStudentServlet2">
	<p>
		学号
		<input type="text" name="stuno" value="${stu.stuno }" readonly="readonly"/>
	</p>
	<p>
		姓名
		<input type="text" name="sname"  value="${stu.sname }" />
	</p>
	<p>
		<label>性别</label>
		  <input type="radio" name="sex" value="男"  <%="男".equals(stu.getSex()) ? "checked":"" %>   />男
		  <input type="radio" name="sex"  value="女"  <%=stu.getSex().equals("女") ? "checked":"" %>  />女
		  <input type="radio" name="sex"  value="妖" <%=stu.getSex().equals("妖") ?  "checked" : "" %>  />妖
		  <input type="radio" name="sex"  value="人妖" <%=stu.getSex().equals("人妖") ?  "checked" : "" %>  />人妖
	</p>
	<p>
		<label>手机号</label>
		<input type="number" name="telephone" value="${stu.telephone }"/>
	</p>
	<p>
		<label>QQ号</label>
		<input type="number" name="qq" value="${stu.qq }"/>
	</p>
	<p>
		<label>微信</label>
		<input type="text" name="wechat" value="${stu.wechat }"/>
	</p>
	<p>
		<label>年级编号</label>
		<input type="number" name="gradeid" value="${stu.gradeid }"/>
	</p>
	<p>
	<label>年级编号</label>
	<%
			Service2 s2=new Service2();
			List<Grade> list=s2.findALL();
			
			%>
			<select name="gradeid">
				<%
				 for(Grade g:list){
				%>
				<option value="<%=g.getId()%>"><%=g.getGname() %></option>
				<%} %>
			</select>
</p>
<p>
	<label>入学日期</label>
	<input type="text" name="enterdate" value="<%
	%>" />
</p>
<p>
	<label>来自哪里</label>
	<input type="text" name="fromcity" value="${stu.fromcity }" />
</p>
<p>
	<label>出生日期</label>
	<input type="text" name="birthday" value="${stu.birthday }" />
</p>
<p>
	<label>地址</label>
	<input type="text" name="address" value="${stu.address }" />
</p>
<p>
	<label>密码</label>
	<input type="number" name="pass" value="${stu.pass }" />
</p>
<p>
	<label>照片</label>
	<input type="file" name="idcardpic" value="${stu.idcardpic }" />
</p>
<input type="submit" value="修改" onclick="return confirm('您确定修改吗？')"/>
</form>
</body>
</html>